﻿using System;

namespace FunctionalProgramming.PatternMatching.TransformingRules
{
   internal class DefaultFunc<TIn, TOut> : ITransformingRule<TIn, TOut>
   {
      private readonly Func<TIn, TOut> output;

      public DefaultFunc(Func<TIn, TOut> output)
      {
         this.output = output;
      }

      public bool DoesInputMatch(TIn input)
      {
         return true;
      }

      public TOut TransformInput(TIn input)
      {
         TOut result = output(input);
         return result;
      }
   }
}